package com.rzico.market.model;


import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.rzico.annotation.IgnoreSwaggerParameter;
import com.rzico.basics.entity.Company;
import com.rzico.basics.entity.Supplier;
import com.rzico.market.entity.InvoiceItem;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Id;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.Date;
import java.util.List;


/**
 * 企业发放的福利金信息
 * Created by macro on 2020/5/20.
 */
@Data
@JsonIgnoreProperties(value= {"handler"})
public class InvoiceVo {

    @ApiModelProperty(value = "开票ID" )
    protected Long invoiceId;

    @ApiModelProperty(value = "商品开票状态(0:未开票,1:已完成)" )
    protected Boolean invoiceState;

    @ApiModelProperty(value = "运营发货时间" )
    protected Date shippingDate;

    @ApiModelProperty(value = "供应商发货时间" )
    protected Date sendDate;

    @ApiModelProperty(value = "完成时间" )
    protected Date completeDate;

    @ApiModelProperty(value = "来源订单" )
    protected Long orderId;

    @ApiModelProperty(value = "订单号" )
    protected String orderSn;

    @ApiModelProperty(value = "送货单ID" )
    protected Long shippingId;

    @ApiModelProperty(value = "送货单编号" )
    protected String shippingSn;

    @ApiModelProperty(value = "买方会员" )
    protected Long memberId;

    @ApiModelProperty(value = "供应商(空为本部，若为京东供应商填与之相关的信息)" )
    protected Long supplierId;

    @ApiModelProperty(value = "产品编号" )
    protected Long productId;

    @ApiModelProperty(value = "条码/货号" )
    protected String productSn;

    @ApiModelProperty(value = "商品名称" )
    protected String productName;

    @ApiModelProperty(value = "单位" )
    protected String productUnit;

    @ApiModelProperty(value = "商品结算成本" )
    protected BigDecimal productCost;

    @ApiModelProperty(value = "商品价格" )
    protected BigDecimal productPrice;

    @ApiModelProperty(value = "商品总金额")
    protected BigDecimal subPrice;

    @ApiModelProperty(value = "数量" )
    protected BigDecimal productQuantity;

    @ApiModelProperty(value = "已开票数量" )
    protected BigDecimal inInvoiceQuantity;

    @ApiModelProperty(value = "商品支付Id" )
    protected Long itemId;

    @ApiModelProperty(value = "支付单项开票状态(0:未开票,1:已完成)" )
    protected Boolean itemState;

    @ApiModelProperty(value = "方式 {0:在线支付,1:线下收款,2:余额支付,3:会员卡支付}" )
    protected Integer method;

    @ApiModelProperty(value = "支付插件" )
    protected String paymentPluginId;

    @ApiModelProperty(value = "付款方式" )
    protected String paymentPluginName;

    @ApiModelProperty(value = "企业id" )
    protected Long companyId;

    @ApiModelProperty(value = "卡id" )
    protected Long cardId;

    @ApiModelProperty(value = "卡号" )
    protected String cardCode;

    @ApiModelProperty(value = "卡备注" )
    protected String cardMemo;

    @ApiModelProperty(value = "付款金额" )
    protected BigDecimal amount;

    @ApiModelProperty(value = "已开票金额" )
    protected BigDecimal invoiceAmount;

    @ApiModelProperty(value = "已开票数量" )
    protected BigDecimal outInvoiceQuantity;

    @ApiModelProperty(value = "归属企业" )
    protected Long enterpriseId;

    @ApiModelProperty(value = "用户手机号码" )
    protected String mobile;

    @ApiModelProperty(value = "用户姓名" )
    protected String name;


    /**
     *  供应商
     */
    @JsonIgnore
    @IgnoreSwaggerParameter
    protected Supplier supplier;

    public String getSupplierName() {
        Supplier supplier = getSupplier();
        if (supplier!=null) {
            return supplier.getName();
        } else {
            return null;
        }
    }

    /**
     *  企业
     */
    @JsonIgnore
    @ApiModelProperty(value = "企业", hidden = true)
    protected Company company;

    public String getCompanyName() {
        Company company = getCompany();
        if (null != company){
            return company.getName();
        }else{
            return "";
        }
    }

}
